package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AWorkorderMapper;
import com.ruoyi.system.domain.AWorkorder;
import com.ruoyi.system.service.IAWorkorderService;

/**
 * 工单信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-11
 */
@Service
public class AWorkorderServiceImpl implements IAWorkorderService 
{
    @Autowired
    private AWorkorderMapper aWorkorderMapper;

    /**
     * 查询工单信息
     * 
     * @param id 工单信息主键
     * @return 工单信息
     */
    @Override
    public AWorkorder selectAWorkorderById(Long id)
    {
        return aWorkorderMapper.selectAWorkorderById(id);
    }

    /**
     * 查询工单信息列表
     * 
     * @param aWorkorder 工单信息
     * @return 工单信息
     */
    @Override
    public List<AWorkorder> selectAWorkorderList(AWorkorder aWorkorder)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aWorkorder.setGroupId(deptId.toString());
        return aWorkorderMapper.selectAWorkorderList(aWorkorder);
    }

    /**
     * 新增工单信息
     * 
     * @param aWorkorder 工单信息
     * @return 结果
     */
    @Override
    public int insertAWorkorder(AWorkorder aWorkorder)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aWorkorder.setGroupId(deptId.toString());
        return aWorkorderMapper.insertAWorkorder(aWorkorder);
    }

    /**
     * 修改工单信息
     * 
     * @param aWorkorder 工单信息
     * @return 结果
     */
    @Override
    public int updateAWorkorder(AWorkorder aWorkorder)
    {
        return aWorkorderMapper.updateAWorkorder(aWorkorder);
    }

    /**
     * 批量删除工单信息
     * 
     * @param ids 需要删除的工单信息主键
     * @return 结果
     */
    @Override
    public int deleteAWorkorderByIds(Long[] ids)
    {
        return aWorkorderMapper.deleteAWorkorderByIds(ids);
    }

    /**
     * 删除工单信息信息
     * 
     * @param id 工单信息主键
     * @return 结果
     */
    @Override
    public int deleteAWorkorderById(Long id)
    {
        return aWorkorderMapper.deleteAWorkorderById(id);
    }
}
